package org.nbict.iot.task.once;

import com.alibaba.fastjson.JSON;
import org.bson.Document;
import org.nbict.iot.task.once.charge.ChargeStatus;
import org.nbict.iot.task.once.journey.JourneyStatus;

/**
 * 车辆的上报点
 */

public class Pointer {

    private Long currentTime; // 当前点时间戳
//    @JSONField(deserializeUsing = EnumDeserializer.class, serializeUsing =
//            EnumSerializer.class)
    private JourneyStatus status; //当前点的状态
    private String vin;

    private Integer soc; //剩余电量

    private Long lon;
    private Long lat;

    private ChargeStatus charged; //是否充电

    public Pointer() {

    }

    public Pointer(String vin, Long currentTime, JourneyStatus status, Integer soc, Long lon, Long lat, ChargeStatus charged) {
        this.vin = vin;
        this.currentTime = currentTime;
        this.status = status;

        this.soc = soc;
        this.lon = lon;
        this.lat = lat;

        this.charged = charged;
    }

    public Pointer(Long currentTime, JourneyStatus status) {
        this.currentTime = currentTime;
        this.status = status;
    }

    public Long currentTime() {
        return currentTime;
    }

    public Pointer setCurrentTime(Long currentTime) {
        this.currentTime = currentTime;
        return this;
    }

    public void setCurrentStatus(JourneyStatus status) {
        this.status = status;
    }

    public Status status() {
        return status;
    }

    public String vin() {
        return vin;
    }


    public Document toDocument() {
        Document doc = new Document();
        doc.append("currentTime", currentTime());
        return doc;
    }

//    public String toJson() {
//        return JSON.toJSONString(this);
//    }


    public Long getCurrentTime() {
        return currentTime;
    }


    public Status getStatus() {
        return status;
    }


    public void setStatus(JourneyStatus status) {
        this.status = status;
    }

    public String getVin() {
        return vin;
    }

    public Pointer setVin(String vin) {
        this.vin = vin;
        return this;
    }

    public String toJSONString() {
        return JSON.toJSONString(this);
    }


    public Integer getSoc() {
        return soc;
    }

    public Pointer setSoc(Integer soc) {
        this.soc = soc;
        return this;
    }

    public Long getLon() {
        return lon;
    }

    public Pointer setLon(Long lon) {
        this.lon = lon;
        return this;
    }

    public Long getLat() {
        return lat;
    }

    public Pointer setLat(Long lat) {
        this.lat = lat;
        return this;
    }

    public ChargeStatus getCharged() {
        return charged;
    }

    public Pointer setCharged(ChargeStatus charged) {
        this.charged = charged;
        return this;
    }

    public ChargeStatus charged() {
        return this.charged;
    }

    @Override
    public String toString() {
        return "vin=> " + vin + " time=> " + currentTime();
    }

}
